import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: 'manager/u',
    method: 'get',
    params: { 'page': query.page - 1, 'size': query.size, 'sort': query.sort, 'username': query.username }
  })
}

export function createUser(data) {
  return request({
    url: 'manager/u',
    method: 'post',
    data
  })
}

export function readUser(data) {
  return request({
    url: '/user/detail',
    method: 'get',
    data
  })
}

export function updateUser(data) {
  return request({
    url: 'manager/u',
    method: 'put',
    data: data
  })
}

export function deleteUser(userId) {
  return request({
    url: '/manager/u/'+userId,
    method: 'delete',
  })
}
